package Work03.Task01;

/**
 * @Author: lu
 * @Date: 2021/9/1 22:06
 * @Description:
 */
public class CopyArray {
    public static String toString(int[] arr){
        if(arr == null)
            return "null";
        int arrMax = arr.length-1;
        if(arrMax== -1)
            return "[]";
        StringBuilder sb = new StringBuilder("[");
        for(int i=0;;i++){
            sb.append(arr[i]);
            if(i==arrMax){
                return sb.append("]").toString();
            }
            sb.append(",");
        }

    }
}
